package com.victor.protobuf;

import com.google.protobuf.InvalidProtocolBufferException;

/**
 * Created by DJJ on 2019/6/2.
 */
public class ProtoBufTest {
    public static void main(String[] args) throws InvalidProtocolBufferException {
        DataInfo.Student build = DataInfo.Student.newBuilder().setAge(20).setName("董").setAddress("guangzhou").build();
        byte[] bytes = build.toByteArray();
        DataInfo.Student student = DataInfo.Student.parseFrom(bytes);
        System.out.println(student);
        System.out.println(student.getName());
    }
}
